package com.syaccp.controller;

import com.syaccp.request.CustomerDetailSelectRequest;
import com.syaccp.service.BankRemitService;
import com.syaccp.service.CustomerBillService;
import com.syaccp.service.CustomerImService;
import com.syaccp.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "客户信息弹窗")
@RestController
@RequestMapping("/api/customerDetail")
public class CustomerDetailController {


    @Resource
    private CustomerBillService cbs;

    @Resource
    private BankRemitService brs;

    @Resource
    private CustomerImService cis;

    @GetMapping("/findCustomerDetails")
    @ApiOperation(value = "分页查询客户详细信息各项类容")
    public Result findCustomerBill(@Validated CustomerDetailSelectRequest customerDetailSelectRequest){
        if ("0".equals(customerDetailSelectRequest.getType())){
            //用户消费查询
            return cbs.findCustomerBill(customerDetailSelectRequest);
        }else if ("1".equals(customerDetailSelectRequest.getType())){
            //用户充值查询
            return brs.findBankRemit(customerDetailSelectRequest);
        }else if ("2".equals(customerDetailSelectRequest.getType())){
            return cis.findImByCustomerId(customerDetailSelectRequest);
        }else {

            return Result.error();
        }


    }


}
